import pymysql

# 1. 拨号连接
connection = pymysql.connect(
    host='localhost',  # 仓库地址
    user='root',  # 仓库管理员
    password='ak47qbz95',  # 管理员密码
    database='hqyj',  # 指定仓库
    port=3306,  # 仓库门牌号
    charset='utf8'  # 沟通语言
)

curser = connection.cursor()
# 2. 创建tb_users-表
curser.execute(
    """
CREATE TABLE IF NOT EXISTS tb_users (
    id INT PRIMARY KEY AUTO_INCREMENT,
    username VARCHAR(20) NOT NULL UNIQUE,
    password VARCHAR(20) NOT NULL
);
"""
)
connection.commit()

curser.close()
connection.close()
